﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PaceR.Data.Transactions
{
    public class SimpleTransactionManager : BaseTransactionManager
    {
        public virtual IList<BaseTransactionItem> Changes { get; protected set; }

        public SimpleTransactionManager()
        {
            Changes = new List<BaseTransactionItem>();
        }

        public override void Commit()
        {
            foreach (var item in Changes)
            {
                item.Execute();
            }
            Changes.Clear();
        }

        public override void Rollback()
        {
            Changes.Clear();
        }
    }
}
